package com.yufuchang;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created by yufuchang on 2020/9/4.
 */
@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer{
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/**") // 配置拦截路径（所有路径都拦截）
                .excludePathPatterns("/interceptor2"); // 配置排除的路径
    }
}
